#ifndef GAME_H
#define GAME_H
//class camera;

//Headers
#include "fixed.h"
#include "player.h"
#include "map.h"
#include "enemy.h"
#include "camera.h"
#include "weapon.h"
#include "powerup.h"

#include "megaman3.h"
//Backgrounds
#include "Maps2.h"
#include "splashScreen.h"
#include "resetYesNo.h"
#include "byeThen.h"
#include "cutScene1.h"
#include "phoneBackground.h"
#include "endGame.h"


//AKS
//foward declartoin of Player class so that game
//has acees to player and player has acces to game
class Player;
class powerup;
class enemy;
//class powerup;

class game{
	private:
		game();
		static game* instance;
		//Sprites
		Player *player;
		//enemy enemyA;
		//enemy enemyB;
		//powerup powerupA;

		//Map
		map Map;

		camera *Camera;

		int vcol;
		int hcol;
		int count;
		int g_counter;
		int g_enemySpawnTrigger;
		int myLevelOneCount;
		int myLevelTwoCount;
		int myLevelThreeCount;
		int myLevelFourCount;	

		int paused;
		int g_currentLevel;

		void pauseGame();
		void deadLeadsToReset();
		
		std::vector<powerup*> powerups;
		
	public:
		static game *getInstance();
		std::vector<enemy*> enemies;

		virtual ~game();
		void startGame();
		void startLevel(int level);
		void update();
		void detectKeys();

		void advanceLevel();
		int getCurrentLevel();
		void resetLevel();
		void clearLevel();
		void cutScene(int level);
		void endGame();

		void createEnemies(int level);
		void makeEnemy(tFloat posX, tFloat posY,int health, int AItype);
		void createPowerups(int level);
		void makePowerup(tFloat posX,tFloat posY,int type);

		//Dectect Collision between player and map
		void detectCollision();
		void detectEnemyCollision();
		void detectEnemyCollisionWithTerrain();
		void detectPlayerCollisionwithPowerup();
		void detectWeaponCollsionWithEnemy();
		void detectWeaponCollsionWithPlayer();
		void detectWeaponCollsionWithTerrain();
		//Control the camera
		void moveScreen();
		//Control enemies
		void moveEnemy();
		//Destroy offscreen projectiles
		void detectOffscreenWeapons();
		void spawnEnemy();
		std::vector<weapon *> projectiles;

};

#endif